<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%--
  ~ Copyright (c) 2017 22420103@QQ.COM 版权所有
  ~
  --%>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />
		<meta name="description" content="Draggabble Widget Boxes with Persistent Position and State" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
		<c:set var="ctx" value="${pageContext.request.contextPath}" />
		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/font-awesome/4.5.0/css/font-awesome.min.css" />
		<!-- page specific plugin styles -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/jquery-ui.custom.min.css" />
		<!-- text fonts -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/fonts.googleapis.com.css" />
		<!-- ace styles -->
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace.min.css" class="ace-main-stylesheet" id="main-ace-style" />
		<!--[if lte IE 9]>
			<link rel="stylesheet" href="${ctx }/static/assets/css/ace-part2.min.css" class="ace-main-stylesheet" />
		<![endif]-->
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="${ctx }/static/assets/css/ace-rtl.min.css" />
		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="${ctx }/static/assets/css/ace-ie.min.css" />
		<![endif]-->
		<!-- inline styles related to this page -->
		<!-- ace settings handler -->
		<script src="${ctx }/static/assets/js/ace-extra.min.js"></script>
		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->
		<!--[if lte IE 8]>
		<script src="${ctx }/static/assets/js/html5shiv.min.js"></script>
		<script src="${ctx }/static/assets/js/respond.min.js"></script>
		<![endif]-->
	</head>

	<body style="background-color: #fff;">
		<div id=context>
			<div class="row">
				<div class="col-xs-12">
					<h3 class="lighter block green">用户设置</h3>
					<!-- PAGE CONTENT BEGINS -->
					<form class="form-horizontal" id="adminUserForm" name="myform" role="form">
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">旧密码</label>
							<div class="col-sm-9">
								<input type="text" name="pwd" id="pwd" placeholder="旧密码" class="col-xs-10 col-sm-5" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">新密码</label>
							<div class="col-sm-9">
								<input type="text" id="newPwd" name="newPwd" placeholder="新密码" class="col-xs-10 col-sm-5" />
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-3 control-label no-padding-right">重复新密码</label>
							<div class="col-sm-9">
								<input type="text" id="repeatPwd" name="repeatPwd" placeholder="重复新密码" class="col-xs-10 col-sm-5" />
							</div>
						</div>
						<div class="clearfix form-actions">
							<div class="col-md-offset-3 col-md-9">
								<button class="btn btn-info" type="button" onclick="sumbitPwd()">
									<i class="ace-icon fa fa-check bigger-110"></i>
									确认
								</button>
								&nbsp; &nbsp; &nbsp;
								<button class="btn" type="reset">
									<i class="ace-icon fa fa-undo bigger-110"></i>
									取消
								</button>
							</div>
						</div>
					</form>

				</div><!-- /.col -->
			</div><!-- /.row -->
		</div>
	</body>
	<script>
		var ctx = "${ctx}";
        //客户端校验
        function check() {
            if ($("#pwd").val() == "") {
                $("#pwd").tips({
                    side : 1,
                    msg : '旧密码不得为空',
                    bg : '#AE81FF',
                    time : 3
                });
                $("#pwd").focus();
                return false;
            }
            if ($("#newPwd").val() == "") {
                $("#newPwd").tips({
                    side : 1,
                    msg : '新密码不得为空',
                    bg : '#AE81FF',
                    time : 3
                });
                $("#newPwd").focus();
                return false;
            }
            if ($("#repeatPwd").val() == "") {
                $("#repeatPwd").tips({
                    side : 1,
                    msg : '重复新密码不得为空',
                    bg : '#AE81FF',
                    time : 3
                });
                $("#repeatPwd").focus();
                return false;
            }
            return true;
        }

		function sumbitPwd() {
            if(!check()){
                return;
			}
            var data = $("#adminUserForm").serialize();
            $.ajax({
                type:"POST",
                url:"modifyUserInfo",
                data:data,
				dataType:"json",
                cache:false,
                success:function(data){
                    alert(data.msg);
                    if(data.code == "1"){
                        window.location.href="${ctx}/admin/systemManager/userSetting";
                    }else {

                    }
                }
            });
        }
	</script>
	<script src="${ctx }/static/assets/js/jquery-2.1.4.min.js"></script>
	<script type="text/javascript" src="${ctx }/static/js/jquery.tips.js"></script>
</html>
